package com.yvon.maple.cloud.api.auth.feign;

import com.yvon.maple.cloud.api.auth.dto.Oauth2TokenDTO;
import com.yvon.maple.cloud.api.auth.feign.factory.RemoteAuthFallbackFactory;
import com.yvon.boot.common.result.ResponseData;
import com.yvon.maple.constants.ServiceNameConstant;
import com.yvon.maple.constants.SystemConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author : Yvon
 * @since : 2021-08-11
 */
@FeignClient(value = ServiceNameConstant.AUTH_SERVICE, fallbackFactory = RemoteAuthFallbackFactory.class)
public interface RemoteAuthClient {

	String PATH = SystemConstant.Common.FEIGN_INSIDE_URL_PREFIX + "/auth";

    /**
     * 查询访问令牌
     *
     * @param parameters 参数
     * @return {@link ResponseData<Oauth2TokenDTO> }
     * @author : Yvon / 2021-08-11
     */
    @PostMapping(value = PATH + "/oauth/token")
    ResponseData<Oauth2TokenDTO> getAccessToken(@RequestParam Map<String, String> parameters);
}
